package com.ymatou.iapi.productquery.service;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

import com.ymatou.iapi.productquery.compare.ProductQueryInterface;
import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.JsonBeanHelper;
import com.ymttest.utils.MapUtil;

public class GetProductListByTradeIsolationCall extends YmatouAutoTestCall implements ProductQueryInterface{
	private static String opurl="/api/Product/GetProductListByTradeIsolation";
	
	public GetProductListByTradeIsolationCall(){
		super(EnvSetup.getSystemUrl("productquery"), opurl, "POST", "JSON");
	}
	
	
	@Override
	public void addDefHeader(){
		client.addHeader("Content-Type", "application/json");
	}
	
	 
	@Override
	public JSONObject search(List<String> prods) {
		JSONObject requestBean = this.getJsonBean(null);
		
		JsonBeanHelper.updateJsonBean(requestBean, MapUtil.hashMap("ProductIdList", new JSONArray(prods)));
		
		return callAndGetReturnData(requestBean);
	}
	
	public JSONObject search(List<String> prods,int NextActivityExpire) {
		JSONObject requestBean = this.getJsonBean(null);
		
		JsonBeanHelper.updateJsonBean(requestBean, MapUtil.hashMap("ProductIdList", new JSONArray(prods),"NextActivityExpire",NextActivityExpire));
		
		return callAndGetReturnData(requestBean);
	}
	
	

	
	public static void main(String[] args) {
		List<String> aList = new ArrayList<>();
		aList.add("41cf8ee1-3d18-46da-9928-023a107b3e4c");
		new GetProductListByTradeIsolationCall().search(aList);
	}
}
